package appapi.dao;
import appapi.Vo.EquipmentsExportVo;
import appapi.dto.GetAppRectDto;
import org.apache.ibatis.annotations.Param;

import appapi.Request.InspectionPageReq;import appapi.entity.Zhongjiao.RectificationDto;
import appapi.entity.app.RectificationEntity;
import org.apache.ibatis.annotations.Mapper;import java.util.List;import java.util.Map;

/**
 * @author djq
 * @date 2023/5/24 16:23
 * @description:
 */

@Mapper
public interface RectificationMapper {
    int deleteByPrimaryKey(Long rectId);

    int deleteBySourceIds(@Param("sourceIds") List<Long> sourceIds);

    int insert(RectificationDto record);

    int insertSelective(RectificationDto record);

    RectificationDto selectByPrimaryKey(Long rectId);

    int updateByPrimaryKeySelective(RectificationDto record);

    int updateByPrimaryKey(RectificationDto record);

    List<Map<String, Object>> selectList(long equip_id);

    List<Map<String, Object>> selectRectificationPage(InspectionPageReq dto);

    List<Map<String, Object>> selectRectificationList(Long equipId);

    List<RectificationDto> selectAllByOperIdAndRectState(GetAppRectDto dto);

    void updateByPrimaryKeyList(RectificationEntity map);

    void insertRectificationAll(List<RectificationEntity> addList);

    void insertRectificationAll2(RectificationEntity entity);

    RectificationDto selectWithEquipByPrimaryKey(Long rectId);


    /**
     * 批量添加违规记录
     * @param addList
     * @return
     */
    int insertBatch(List<RectificationEntity> addList);

    /**
     * 批量删除整改记录（source）
     * @param rectType
     * @param rectIds
     * @return
     */
    int deleteBatch(@Param("rectType") Integer rectType,@Param("rectIds") List<Long> rectIds);

    /**
     * 根据主记录id进行删除整改
     * @param rectType
     * @param rectSource
     * @return
     */
    int deleteByRecId(@Param("rectType") Integer rectType,@Param("rectSource") Long rectSource);

    /**
     * 根据主记录id进行删除整改
     * @param rectType
     * @param rectSources
     * @return
     */
    int deleteSourcesBatch(@Param("rectType") Integer rectType,@Param("rectSources") List<Long> rectSources);
    /**
     * 根据主记录id判断是否允许编辑删除
     * @param rectType
     * @param rectSource
     * @return
     */
    int allowEdit(@Param("rectType") Integer rectType,@Param("rectSource") List<Long> rectSource);

    List<EquipmentsExportVo> RectificationRecExport(InspectionPageReq req);

   Integer getFinishCount(@Param("orgaId") Long orgaId);
    Integer getUnFinishCount(@Param("orgaId") Long orgaId);
    Integer getCreateTimeData(@Param("createTime") String createTime,@Param("orgaId") Long orgaId);
    Integer getUpdateTimeData(@Param("updateTime") String updateTime,@Param("orgaId") Long orgaId);
}